from selenium import webdriver
from selenium.webdriver import ChromeOptions
import datetime


class WebCrawler():

    def __init__(self):
        option = ChromeOptions()
        # option.add_argument("--headless")
        # option.add_argument("--disable-gpu")
        option.add_experimental_option('excludeSwitches', ['enable-automation'])
        option.add_experimental_option('useAutomationExtension', False)
        self.wd = webdriver.Chrome(options=option, executable_path=r'd:\chromedriver.exe')
        self.wd.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument', {
            'source': 'Object.defineProperty(navigator, "webdriver", {get: () => undefined})'
        })
        self.wd.implicitly_wait(10)
        self.today = datetime.date.today().strftime('%Y-%m-%d')